/**
 * 指标考核 > 模板  by mingyue
 * rckhkpitemplatedetail
 */

import request from '@/router/axios'

// 1.获取模板名称列表
export function tempage(query){
  return request({
    url: '/appr-event/rckhtemplatemain/page',
    method: 'get',
    params: query
  })
}

// 2.新增模板校验
export function isExsitTemplateName(query){
  return request({
    url: '/appr-event/rckhtemplatemain/isExsitTemplateName',
    method: 'get',
    params: query
  })
}

// 3.获取模板配置明细
export function getTempList(query){
  return request({
    url: '/appr-event/rckhkpitemplatedetail/getTempList',
    method: 'get',
    params: query
  })
}

// 4.启用 修改每个节点的配置
export function saveTemplatehang(data) {
  return request({
    url: '/appr-event/rckhkpitemplatedetail/saveTemplate',
    method: 'post',
    data: data
  })
}


export function copyTemplateMainAndDetail(data) {
  return request({
    url: '/appr-event/rckhtemplatemain/copyTemplateMainAndDetail',
    method: 'get',
    params: data
  })
}

// 模板保存
export function saveTemplate(query){
  return request({
    url: '/appr-contract/hetongacttemplate/saveTemplate',
    method: 'post',
    data: query
  })
}

//模板删除
export function deleteBatch(query){
  return request({
    url: '/appr-event/rckhtemplatemain/deleteBatch',
    method: 'get',
    params: query
  })
}


// 新增模板
export function saveTemplateName(query){
  return request({
    url: '/appr-event/rckhtemplatemain/saveTemplate',
    method: 'post',
    data: query
  })
}



// 失去焦点保存
// export function saveTemplateUser(data) {
//   return request({
//     url: '/appr-event/rckhtemplatedetail/saveTemplateUserList',
//     method: 'post',
//     data: data
//   })
// }

// 提交模板有效性
export function effective(data) {
  return request({
    url: '/appr-event/rckhtemplatemain/getEffectiveTemplate',
    method: 'get',
    params: data
  })
}

// 模板shanchu
export function deleteBatchtem(data) {
  return request({
    url: '/appr-event/rckhtemplatemain/deleteBatch',
    method: 'get',
    params: data
  })
}


export function alldepeuser(query) {
  return request({
    url: '/appr-event/rckhtemplatemain/alltree',
    method: 'get',
    params: query
  })
}

export function mydept(query) {
  return request({
    url: '/appr-event/rckhtemplatemain/getMyDept',
    method: 'get',
    params: query
  })
}

export function getNodeInfo(proId) {
  return request({
    url: '/appr-event/rckhsjtask/getCurrentTask/' + proId,
    method: 'get'
  })
}

export function changeAss(query){
  return request({
    url: '/appr-event/rckhsjtask/changeAss',
    method: 'get',
    params: query
  })
}

export function putObjstateChange(data) {
  return request({
    url: '/appr-event/rckhtemplatemain/setZmb',
    method: 'post',
    data: data
  })
}

export function putObjstateChangeZb(data) {
  return request({
    url: '/appr-event/rckhkpitemplatemain/setZmb',
    method: 'post',
    data: data
  })
}
export const  radioTwoList=[
  {value:'-1',name:'全部'},
  {value:'1',name:'本部'},
  {value:'0',name:'所属机构'}
]

//模板分页
export function getemPage(query){
  return request({
    url: '/appr-contract/hetongacttemplate/page',
    method: 'get',
    params: query
  })
}

//直接推送履约中
export function createTb(query){
  return request({
    url: '/appr-event/routineAssessKpi/createTb',
    method: 'get',
    params: query
  })
}
//验证是否已有创建数据
export function checkCurTarget(query){
  return request({
    url: '/appr-event/routineAssessKpi/checkCurTarget',
    method: 'get',
    params: query
  })
}

//生成指标考核数据
export function createTarget(query){
  return request({
    url: '/appr-event/routineAssessKpi/createTarget',
    method: 'get',
    params: query
  })
}

export function getFilldateById(id) {
  return request({
    url: `/appr-event/routineAssess/getFilldateById/${id}`,
    method: 'get',
  })
}

